package com.nw.controller;

import com.nw.entity.Comment;
import com.nw.entity.CommentPermission;
import com.nw.service.CommentPermissionService;
import com.nw.service.CommentService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;

@RestController
@RequestMapping("comment")
public class CommentController {
    @Resource
    CommentService commentService;
    @Resource
    CommentPermissionService commentPermissionService;
    @RequestMapping("addComment")
    public HashMap<String, Object> addComment(Comment comment, String commentPermissionId){
        HashMap<String, Object> map = commentService.addComment(comment);
        commentPermissionService.updateCommentPermission(commentPermissionId);
        return map;
    }
    @RequestMapping("deleteComment")
    public HashMap<String, Object> deleteComment(Comment comment){
        HashMap<String, Object> map = commentService.deleteComment(comment);
        return map;
    }
}
